package com.sg.service.biz.bff.impl;

import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.bff.req.BffImplementRemovalMessageCorrelationReqDto;
import com.sg.dto.biz.bff.req.BffImplementShareEveryoneIdeasDeptReqDto;
import com.sg.dto.biz.bff.req.BffRefreshChangeMessageContentReqDto;
import com.sg.dto.biz.bff.res.BffImplementRemovalMessageCorrelationRespDto;
import com.sg.dto.biz.bff.res.BffImplementShareEveryoneIdeasDeptRespDto;
import com.sg.dto.biz.bff.res.BffRefreshChangeMessageContentRespDto;
import com.sg.dto.integration.app.ImplementShareEveryoneIdeasDeptComReqDto;
import com.sg.dto.integration.app.ImplementShareEveryoneIdeasDeptComRespDto;
import com.sg.dto.integration.component.ImplementRemovalMessageCorrelationComReqDto;
import com.sg.dto.integration.component.ImplementRemovalMessageCorrelationComRespDto;
import com.sg.dto.integration.component.UpdateChangeMessageContentComReqDto;
import com.sg.dto.integration.component.UpdateChangeMessageContentComRespDto;
import com.sg.service.biz.bff.CommunicationService;
import com.wicket.okrapp.integration.CommunicationService;
import com.sg.common.exception.Assert;
import com.wicket.okrcomponent.integration.CommunicationService;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
//import com.wicket.okrcomponent.integration.dto.ImplementShareEveryoneIdeasDeptComRespDto;
//import com.wicket.okrcomponent.integration.dto.ImplementShareEveryoneIdeasDeptComReqDto;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class CommunicationServiceImpl implements CommunicationService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    com.sg.service.biz.component.CommunicationService fwCompCommunicationClient;
    @Resource
    com.sg.service.biz.app.CommunicationService fwAppCommunicationClient;

    /**
     * B2更新变更消息内容[8357]
     * gen by moon at 1/25/2024, 10:05:49 PM
     */
    @Trace(operationName = "B2更新变更消息内容")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffRefreshChangeMessageContentRespDto refreshChangeMessageContent(BffRefreshChangeMessageContentReqDto reqDto) {


        //步骤0: D2修改变更消息内容(公共) - updateChangeMessageContentCom
        UpdateChangeMessageContentComRespDto updateChangeMessageContentComRespDto = null;
        UpdateChangeMessageContentComReqDto updateChangeMessageContentComReqDto = new UpdateChangeMessageContentComReqDto();
        if (reqDto != null) {
            updateChangeMessageContentComReqDto.setMessageId(reqDto.getMessageId());//SimpleFieldAssign//sourceId:1508170_1
            updateChangeMessageContentComReqDto.setMessageTitle(reqDto.getMessageTitle());//SimpleFieldAssign//sourceId:1508171_1
            updateChangeMessageContentComReqDto.setMessageContent(reqDto.getMessageContent());//SimpleFieldAssign//sourceId:1508172_1
            updateChangeMessageContentComReqDto.setReferenceMessageId(reqDto.getReferenceMessageId());//SimpleFieldAssign//sourceId:1508173_1
            updateChangeMessageContentComReqDto.setReferenceMessageContent(reqDto.getReferenceMessageContent());//SimpleFieldAssign//sourceId:1508174_1
            updateChangeMessageContentComReqDto.setIsBoutique(reqDto.getIsBoutique());//SimpleFieldAssign//sourceId:1508175_1
            updateChangeMessageContentComReqDto.setThemeContentTypeCode(reqDto.getThemeContentTypeCode());//SimpleFieldAssign//sourceId:1508176_1
            updateChangeMessageContentComReqDto.setThemeContentId(reqDto.getThemeContentId());//SimpleFieldAssign//sourceId:1508177_1
            updateChangeMessageContentComReqDto.setCooperateContentTypeCode(reqDto.getCooperateContentTypeCode());//SimpleFieldAssign//sourceId:1508178_1
            updateChangeMessageContentComReqDto.setCooperateContentId(reqDto.getCooperateContentId());//SimpleFieldAssign//sourceId:1508179_1
            updateChangeMessageContentComReqDto.setSurfaceContName(reqDto.getSurfaceContName());//SimpleFieldAssign//sourceId:1508180_1
            updateChangeMessageContentComReqDto.setMediaType(reqDto.getMediaType());//SimpleFieldAssign//sourceId:1508181_1
            updateChangeMessageContentComReqDto.setMediaAddress(reqDto.getMediaAddress());//SimpleFieldAssign//sourceId:1508182_1
        }

        /*D2修改变更消息内容(公共)[8355]   */
        Assert.isNull(updateChangeMessageContentComReqDto.getMessageId(), "B2更新变更消息内容-D2修改变更消息内容(公共)-消息ID不能为空", false);
        updateChangeMessageContentComRespDto = fwCompCommunicationClient.updateChangeMessageContentCom(updateChangeMessageContentComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        BffRefreshChangeMessageContentRespDto retData = new BffRefreshChangeMessageContentRespDto();


        return retData;
    }

    /**
     * B2执行删除消息及相关[8352]
     * gen by moon at 1/27/2024, 6:29:57 PM
     */
    @Trace(operationName = "B2执行删除消息及相关")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffImplementRemovalMessageCorrelationRespDto implementRemovalMessageCorrelation(BffImplementRemovalMessageCorrelationReqDto reqDto) {


        //步骤0: D2执行删除消息及相关(公共) - implementRemovalMessageCorrelationCom
        ImplementRemovalMessageCorrelationComRespDto implementRemovalMessageCorrelationComRespDto = null;
        ImplementRemovalMessageCorrelationComReqDto implementRemovalMessageCorrelationComReqDto = new ImplementRemovalMessageCorrelationComReqDto();
        implementRemovalMessageCorrelationComReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1507680_1
        if (reqDto != null) {
            implementRemovalMessageCorrelationComReqDto.setMessageId(reqDto.getMessageId());//SimpleFieldAssign//sourceId:1507679_1
            implementRemovalMessageCorrelationComReqDto.setMemberMessageId(reqDto.getMemberMessageId());//SimpleFieldAssign//sourceId:1507678_1
            implementRemovalMessageCorrelationComReqDto.setMessageLocationTypeCode(reqDto.getMessageLocationTypeCode());//SimpleFieldAssign//sourceId:1507681_1
        }

        /*D2执行删除消息及相关(公共)[8351]   */
        Assert.isNull(implementRemovalMessageCorrelationComReqDto.getMessageId(), "B2执行删除消息及相关-D2执行删除消息及相关(公共)-消息ID不能为空", false);
        Assert.isNull(implementRemovalMessageCorrelationComReqDto.getMessageLocationTypeCode(), "B2执行删除消息及相关-D2执行删除消息及相关(公共)-消息位置标识不能为空", false);
        Assert.isNull(implementRemovalMessageCorrelationComReqDto.getSpaceId(), "B2执行删除消息及相关-D2执行删除消息及相关(公共)-创建于空间ID不能为空", false);
        implementRemovalMessageCorrelationComRespDto = fwCompCommunicationClient.implementRemovalMessageCorrelationCom(implementRemovalMessageCorrelationComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        BffImplementRemovalMessageCorrelationRespDto retData = new BffImplementRemovalMessageCorrelationRespDto();


        return retData;
    }

    /**
     * B3执行分享到部门大家想法[8359]
     * gen by moon at 1/26/2024, 5:14:52 AM
     */
    @Trace(operationName = "B3执行分享到部门大家想法")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffImplementShareEveryoneIdeasDeptRespDto implementShareEveryoneIdeasDept(BffImplementShareEveryoneIdeasDeptReqDto reqDto) {


        //步骤0: D3执行分享到部门大家想法(公共) - implementShareEveryoneIdeasDeptCom
        ImplementShareEveryoneIdeasDeptComRespDto implementShareEveryoneIdeasDeptComRespDto = null;
        ImplementShareEveryoneIdeasDeptComReqDto implementShareEveryoneIdeasDeptComReqDto = new ImplementShareEveryoneIdeasDeptComReqDto();
        if (reqDto != null) {
            implementShareEveryoneIdeasDeptComReqDto.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:1508660_1
            implementShareEveryoneIdeasDeptComReqDto.setChannelName(reqDto.getChannelName());//SimpleFieldAssign//sourceId:1508661_1
            implementShareEveryoneIdeasDeptComReqDto.setMessageId(reqDto.getMessageId());//SimpleFieldAssign//sourceId:1508664_1
        }

        /*D3执行分享到部门大家想法(公共)[8358]   */
        Assert.isNull(implementShareEveryoneIdeasDeptComReqDto.getDeptId(), "B3执行分享到部门大家想法-D3执行分享到部门大家想法(公共)-部门ID不能为空", false);
        Assert.isNull(implementShareEveryoneIdeasDeptComReqDto.getChannelName(), "B3执行分享到部门大家想法-D3执行分享到部门大家想法(公共)-通道名称不能为空", false);
        Assert.isNull(implementShareEveryoneIdeasDeptComReqDto.getMessageId(), "B3执行分享到部门大家想法-D3执行分享到部门大家想法(公共)-消息ID不能为空", false);
        implementShareEveryoneIdeasDeptComRespDto = fwAppCommunicationClient.implementShareEveryoneIdeasDeptCom(implementShareEveryoneIdeasDeptComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        BffImplementShareEveryoneIdeasDeptRespDto retData = new BffImplementShareEveryoneIdeasDeptRespDto();


        return retData;
    }
    //
}
